package com.magenta.maxoptra.gis.distancematrix;

import com.magenta.maxoptra.gis.GeographicCoordinates;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Data transfer object for some commands
 *
 * @author Sergey Grachev
 */
public final class MatrixCoordinates {

    private final long matrixId;
    private final List<GeographicCoordinates> coordinates;

    private MatrixCoordinates(final long matrixId, final List<DistanceMatrixCoordinate> coordinates) {
        this.coordinates = new ArrayList<GeographicCoordinates>(coordinates);
        this.matrixId = matrixId;
    }

    public static MatrixCoordinates newInstance(final long matrixId, final DistanceMatrixCoordinate... coordinates) {
        return new MatrixCoordinates(matrixId, Arrays.asList(coordinates));
    }

    public static MatrixCoordinates newInstance(final long matrixId, final List<DistanceMatrixCoordinate> coordinates) {
        return new MatrixCoordinates(matrixId, coordinates);
    }

    public List<GeographicCoordinates> getCoordinates() {
        return coordinates;
    }

    public long getMatrixId() {
        return matrixId;
    }
}
